import { BasicColumn, FormSchema } from '/@/components/Table';

import { getDepts as getAllDept } from '/@/api/org/dept';
import { getAllList as  getAllUser } from '/@/api/privilege/account';
import { getAllRole  } from '/@/api/work/workrole';


export const columns: BasicColumn[] = [
  {
    title: '角色名称',
    dataIndex: 'roleName',
  },
  {
    title: '用户',
    dataIndex: 'realName',
  },
  {
    title: '部门',
    dataIndex: 'deptName',
  },
];


export const setAccountFormSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },

  {
    field: 'roleId',
    label: '角色',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: getAllRole,
      showSearch: true, 
      optionFilterProp: 'label',
      resultField: 'data',
      labelField: 'name',
      valueField: 'id',
    },
  },
  {
    field: 'userId',
    label: '用户',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: getAllUser,
      showSearch: true, 
      optionFilterProp: 'label',
      resultField: 'data',
      labelField: 'realName',
      valueField: 'id',
    },
  },
  {
    field: 'deptId',
    label: '部门',
    helpMessage: '选择的部门作为用户的业务负责人',
    component: 'ApiSelect',
    componentProps: {
      api: getAllDept,
      showSearch: true, 
      optionFilterProp: 'label',
      resultField: 'data',
      labelField: 'name',
      valueField: 'id',
    },
  },
]

